package com.gxgeek.spring.security.dto;

import com.fasterxml.jackson.annotation.JsonView;
import com.gxgeek.spring.security.validator.GxConstraint;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Past;
import java.util.Date;

/**
 * @author gaoxing
 * @create 2017-09-29 下午9:32
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class User {
    public interface UserSimpleView {};
    public interface UserDetailView extends UserSimpleView {};

    @JsonView(UserSimpleView.class)
    private String id;

    @GxConstraint(message = "这是一个测试")
    @ApiModelProperty(value = "用户名")
    @JsonView(UserSimpleView.class)
    private String username;

    @NotBlank(message = "密码不能为空")
    @JsonView(UserDetailView.class)
    private String password;

    @Past(message = "生日必须是过去的时间")
    @JsonView(UserSimpleView.class)
    private Date birthday;
}
